import 'package:flame/components.dart';
import 'package:flame/effects.dart';
import 'package:flutter/animation.dart';

class CameraController {
  final CameraComponent camera;

  CameraController(this.camera);

  void moveTo(
    Vector2 target, {
    required VoidCallback onComplete,
    required double duration,
  }) {
    camera.viewfinder.add(
      MoveToEffect(
        target,
        EffectController(
          duration: duration,
          curve: Curves.easeInOut,
        ),
        onComplete: onComplete,
      ),
    );
  }
}
